package com.ming.projecttest.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.ming.projecttest.R;

public class ExampleFragment extends Fragment {

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        Log.i(TAG, "ExampleFragment onAttach");
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.i(TAG, "ExampleFragment onCreate");
    }



    @Override
    public void onDetach() {
        super.onDetach();
        Log.i(TAG, "ExampleFragment onDetach");
    }

    public static final String TAG = "ExampleFragment";
    /**
     * 添加 Fragment 到 Activity 有两种方式
     * 1. XML
     * 2. 代码插入
     */
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        Log.i(TAG, "ExampleFragment onCreateView");
        View view = inflater.inflate(R.layout.example_fragment, container, false);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        Log.i(TAG, "ExampleFragment onActivityCreated");
    }

    @Override
    public void onStart() {
        super.onStart();
        Log.i(TAG, "ExampleFragment onStart");
    }

    @Override
    public void onResume() {
        super.onResume();
        Log.i(TAG, "ExampleFragment onResume");
    }

    @Override
    public void onPause() {
        super.onPause();
        Log.i(TAG, "ExampleFragment onPause");
    }

    @Override
    public void onStop() {
        super.onStop();
        Log.i(TAG, "ExampleFragment onStop");
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        Log.i(TAG, "ExampleFragment onDestroyView");
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.i(TAG, "ExampleFragment onDestroy");
    }
}
